package com.student.dms;

import android.app.Application;

import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.student.db.AppDatabase;

public class DMSApplication extends Application {

    private AppDatabase mRoomDatabase;
    private static DMSApplication mDMSApplication;

    @Override
    public void onCreate() {
        super.onCreate();
        mDMSApplication=this;
        String dir = getFilesDir().getAbsolutePath() + "/room_db";
        mRoomDatabase =
                Room.databaseBuilder(this, AppDatabase.class, dir)
                .build();
        CrashHandlerUtil.instance().init(this);
    }

    public static DMSApplication getApplication(){
        return mDMSApplication;
    }
    public AppDatabase getRoomDatabase(){
        return mRoomDatabase;
    }

}
